function mat = build_dim1(d1,d2)
% function mat = build_dim1(d1,d2)
% integrational kernel of one dimensional case.
mat = zeros(d1+1,d2+1);
for i = 0:d1
    for j = 0:d2
        mat(i+1,j+1) = prod(1:(i+j))/(prod(1:i)*prod(1:j)) * prod(1:(d1+d2-i-j))/(prod(1:(d1-i))*prod(1:(d2-j)));
    end
end
mat = prod(1:d1)*prod(1:d2)/prod(1:(d1+d2+1)) * mat;